package com.sanchunhui.psc.presenter

import com.sanchunhui.psc.data.protocol.ResponseInfo
import com.sanchunhui.psc.ext.excute
import com.sanchunhui.psc.presenter.view.AddTeamView
import com.sanchunhui.psc.rx.BaseSubscriber
import com.sanchunhui.psc.service.ProjectTeamService
import javax.inject.Inject

/**
 * @Author zyx
 * @Date 2021/7/13-12:41
 * @Dscribe
 */
class AddTeamPresenter @Inject constructor() : BasePresenter<AddTeamView>() {

    @Inject
    lateinit var teamService: ProjectTeamService

    /*
        添加分组到所在项⽬
     */
    fun addTeam( token: String,
                 name: String,
                 leader_member_id: Int) {
        if (!checkNetWork()) {
            return
        }
        mView.showLoading()
        teamService.addTeam(token, name, leader_member_id).excute(object : BaseSubscriber<ResponseInfo>(mView) {
            override fun onNext(t: ResponseInfo) {
                mView.onGetAddTeamResult(t)
            }
        }, lifecycleProvider)

    }
}